function Nfg = plot_figure_sep(VAR,VARChol,VARbs,VARCholbs,nCol,nRow,ii_smpl)
% Code based on Gertler and Karadi (2015)

fig=figure();
set(gcf,'DefaultAxesFontSize',VAR.fontsize);
set(gcf,'DefaultTextFontSize',VAR.fontsize);

xmin    =   1;
xmax    =   VAR.irhor;
ymin    =   NaN(1,VAR.n);
ymax    =   NaN(1,VAR.n);

for nvar=1:VAR.n
    % Create axes
    ymin_temp =  min(min([VARCholbs.irsL(:,nvar); VARbs.irsL(:,VARChol.chol_order(nvar))]));
    ymax_temp =  max(max([VARCholbs.irsH(:,nvar); VARbs.irsH(:,VARChol.chol_order(nvar))]));
    ydiff = abs(ymax_temp-ymin_temp);
    ymin(1,VARChol.chol_order(nvar)) =  floor(10*(ymin_temp-ydiff*0.025))/10;
    ymax(1,VARChol.chol_order(nvar)) =  ceil(10*(ymax_temp+ydiff*0.025))/10;
end;

for nvar=1:VAR.n
    
    subplot(nCol,nRow,2*nvar-1); plot(1:VAR.irhor,VAR.irs(:,nvar),'LineWidth',2,'Color','k'); title(VAR.select_vars_label(1,nvar));  axis manual; axis([xmin xmax ymin(1,nvar) ymax(1,nvar)]); ylabel('%');
    hold on
    subplot(nCol,nRow,2*nvar-1); plot(1:VAR.irhor,VARbs.irsH(:,nvar),'LineWidth',1,'Color','k','LineStyle','--');
    hold on
    subplot(nCol,nRow,2*nvar-1); plot(VARbs.irsL(:,nvar),'LineWidth',1,'Color','k','LineStyle','--');
    set(gca,'YGrid','off','XGrid','on');
    grid
    if nvar==1
    legend('External Instrument');
    end;
    
end;

for nvar=1:VAR.n
    subplot(nCol,nRow,2*VARChol.chol_order(nvar)); plot(1:VARChol.irhor,VARChol.irs(:,nvar),'LineWidth',2,'Color','b');  title(VAR.select_vars_label(1,VARChol.chol_order(nvar))); axis manual; axis([xmin xmax ymin(1,VARChol.chol_order(nvar)) ymax(1,VARChol.chol_order(nvar))]);  set(gcf, 'Color', 'w'); ylabel('%');
    hold on
    subplot(nCol,nRow,2*VARChol.chol_order(nvar)); plot(1:VARChol.irhor,VARCholbs.irsH(:,nvar),'LineWidth',1,'Color','b','LineStyle','--');
    hold on
    subplot(nCol,nRow,2*VARChol.chol_order(nvar)); plot(VARCholbs.irsL(:,nvar),'LineWidth',1,'Color','b','LineStyle','--');
    hold on

    set(gca,'YGrid','off','XGrid','on');
    grid
    if VARChol.chol_order(nvar)==1
    legend('Cholesky');
    end;
end;

fig_pos=get(fig,'Position');
set(fig,'Position',[100 100 900 850]);        
h=axes('Position',[0,0,1,1],'Xlim',[0 1],'Ylim',[0 1]);
set(h,'Visible','off');
%F-test and R2s (print at the bottom) [in %]
string_F_m_rob=['Robust F: ' num2str(VAR.F_m_rob(1),'%2.2f')];
text('Position',[0.41-0.15 0.05],'string',string_F_m_rob, 'FontSize', 11);
string_R2_m = ['R2: ' num2str(VAR.R2_m(1)*100,'%1.2f') '%'];
text('Position',[0.575-0.12 0.05],'string',string_R2_m, 'FontSize', 11);
string_R2adj_m = ['Adjusted R2: ' num2str(VAR.R2adj_m(1)*100,'%1.2f') '%'];
text('Position',[0.7-0.10 0.05],'string',string_R2adj_m, 'FontSize', 11);
text('Position',[0.7-0.10 0.0],'string','', 'FontSize', 11);

saveas(fig, '../02_Figures/SVAR_LongSample.pdf');
print('../02_Figures/SVAR_LongSample','-depsc');

close(fig);

Nfg=1;
